home *** CD-ROM | disk | FTP | other *** search
- /*
- File: StorageDriverHeader.c
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- Copyright: © 1998 by Apple Computer, Inc., all rights reserved.
-
-
- */
-
-
-
- #include <Types.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <USB.h>
-
- #include "SampleStorageDriver.h"
- #include "SampleStorageVersion.h"
- #include "SampleStorageDeviceID.h"
-
- //------------------------------------------------------
- //
- // Protos
- //
- //------------------------------------------------------
- OSStatus StorageDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc);
- OSStatus StorageDriverInitDevice(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- OSStatus StorageDriverInitInterface( UInt32 interfaceNum, USBInterfaceDescriptor *interfaceDesc, USBDeviceDescriptor *deviceDesc, USBDeviceRef device);
- OSStatus StorageDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr desc );
- OSStatus StorageDriverNotifyProc(UInt32 notification, void *pointer);
-
- //------------------------------------------------------
- //
- // This is the driver description structure that the expert looks for first.
- // If it's here, the information within is used to match the driver
- // to the device whose descriptor was passed to the expert.
- // Information in this block is also used by the expert when an
- // entry is created in the Name Registry.
- //
- //------------------------------------------------------
- USBDriverDescription TheUSBDriverDescription =
- {
- // Signature info
- kTheUSBDriverDescriptionSignature, // 'usbd'
- kInitialUSBDriverDescriptor, // 0
-
- // Device Info
- kDriverVendorID, // USB Vendor ID
- kDriverProductID, // USB Product ID.
- 0, // Release Number of Device
- 0, // Protocol Info.
-
- // Interface Info (* I don't think this would always be required...*)
- 0, // Configuration Value
- 0, // Interface Number
- 0, // Interface Class
- 0, // Interface SubClass
- 0, // Interface Protocol
-
-
- // Driver Info
- "\pUSB Storage Class", // Driver name for Name Registry
- kDriverClassID, // Device Class (from USBDeviceDefines.h)
- kDriverSubClassID, // Device Subclass for version 13 and later of Shuttle firmware
- kStorageHexMajorVers, kStorageHexMinorVers, kStorageReleaseStage, kStorageCurrentRelease, // version of driver = 0.0d0
-
- // Driver Loading Info
- 0x00000000 // Flags (currently undefined)
- };
-
- USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
- {
- kClassDriverPluginVersion, // Version of this structure
- StorageDriverValidateHW, // Hardware Validation Procedure
- StorageDriverInitDevice, // Initialization Procedure
- StorageDriverInitInterface, // Interface Initialization Procedure
- StorageDriverFinalize, // Finalization Procedure
- StorageDriverNotifyProc, // Driver Notification Procedure
- };
-
- // Hardware Validation
- // Called upon load by Expert
- OSStatus
- StorageDriverValidateHW( USBDeviceRef device,
- USBDeviceDescriptor *desc)
- {
- device = 0;
- desc = 0;
- return (OSStatus)noErr;
- }
-
-
- // Initialization function
- // Called upon load by Expert
- OSStatus
- StorageDriverInitDevice( USBDeviceRef device,
- USBDeviceDescriptorPtr pDesc,
- UInt32 busPowerAvailable)
- {
- busPowerAvailable = 0;
-
- StorageDriverEntry(device, pDesc, NULL );
-
- return (OSStatus)noErr;
- }
-
- // StorageDriverInitInterface function
- // Called to initialize driver for an individual interface - either by expert or
- // internally by driver
- OSStatus
- StorageDriverInitInterface( UInt32 interfaceNum,
- USBInterfaceDescriptor *interfaceDesc,
- USBDeviceDescriptor *deviceDesc,
- USBDeviceRef device)
- {
- interfaceNum = 0;
-
- StorageDriverEntry(device, deviceDesc, interfaceDesc );
-
- return (OSStatus)noErr;
- }
-
- // Termination function
- // Called by Expert when driver is being shut down
- OSStatus
- StorageDriverFinalize( USBDeviceRef device,
- USBDeviceDescriptorPtr desc )
- {
- #pragma unused(device)
- #pragma unused(desc)
-
- StorageClassDriverFinalize();
-
- return (OSStatus)noErr;
- }
-
- OSStatus
- StorageDriverNotifyProc(UInt32 notification,
- void* pointer)
- {
- return(StorageClassDriverNotifyProc(notification, pointer));
- }
-